<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>实现反馈意见表单中的网页特效</title>

<link rel="stylesheet" type="text/css" href="css/css.css"/>

<script src="js/jquery.js" type="text/javascript"></script>

</head>

<body>

<div class="list_feedback_panel">
<p>
  <span class="icon"></span>
  <span class="tip">对商品列表页面有意见或建议</span>
  <a href="javascript:void(0)" id="list_feedback_show"  style="display: inline" 
     onclick="hideShow();return false;">我要说两句</a>
  <span class="hidden" id="list_feedback_hit">谢谢您的反馈！</span>
</p>
<div class="feedback_form hidden" id="list_feedback_content_div">
  <textarea class="default" id="list_feedback_content">请留下您对商品列表页的意见或建议</textarea>
  <div class="btn_panel">
    <a href="javascript:void(0)" id="list_feedback_submit" style="text-decoration:none" 
       name="cancel_S" onclick="submitSuggestion();return false;">
        <span>提&nbsp;&nbsp;交</span>
    </a>
    <a href="javascript:void(0)" id="list_feedback_cancel" name="cancel_S" 
       onclick="cancelSuggestion();return false;">
        <span>取&nbsp;&nbsp;消</span>
    </a>
  </div>
</div>
</div>

<script type="text/javascript">
function hideShow(){
	$("#list_feedback_show").hide();
	$("#list_feedback_content_div").show();
  }
  
function submitSuggestion(){
  $("#list_feedback_hit").show();
  var content = $("#list_feedback_content").val();
  if($.trim(content)=='请留下您对商品列表页的意见或建议')
	  content = '';
  var send_url = document.location.toString();
  var research_type = 670;
  if(content!=''){
	$.post("../hosts/callback.php",   
	  {
		"type":"research",
		"send_url":send_url,
		"content":content,
		"research_type":research_type,
		"t":Math.random()
	  },
	  function(data){
		if(data!=="0"){
			$("#list_feedback_content_div").hide();
			$("#list_feedback_show").hide();
			$("#list_feedback_hit").removeClass("hidden");
		}else{
			alert("网络链接问题，请稍后提交");
		}
	});
  } 
}
  
function cancelSuggestion(){
	$("#list_feedback_content_div").hide();
	$("#list_feedback_show").show();	
	$("#list_feedback_content").val('请留下您对商品列表页的意见或建议');
	$("#list_feedback_content").addClass('default');
	$("#list_feedback_hit").hide();
	$("#list_feedback_hit").addClass("hidden");
  }
  
$(function(){
  $("#list_feedback_content").focus(function(){
	var obj = $(this);
	obj.removeClass("default");
	if($.trim(obj.val())=='请留下您对商品列表页的意见或建议')
		obj.val('');
  }).bind("blur",function(){
	var obj = $(this);
	if($.trim(obj.val()).length==0){
		obj.addClass("default");
		obj.val('请留下您对商品列表页的意见或建议');
	}
  });
});
</script>

</body>
</html>
